package org.example4;

import org.example4.a.ProductService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

//springjunit集成测试
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations= "classpath:applicationContext-annoAop.xml")
public class SpringTestAspectJAnno {
	//注入要测试bean
	@Autowired
	private CustomerService customerService;

	@Autowired
	private ProductService productService;

	//测试
	@Test
	public void test(){
		//基于接口
		customerService.save();
//		customerService.find();

		System.out.println();

		productService.find();

		System.out.println();

		//	扩展方法执行:只有走cgLib代理才能正确执行
		((CustomerServiceImpl)customerService).update();
	}
}
